package com.ming.springboot.service.impl;

import com.ming.springboot.mbg.mapper.StudentMapper;
import com.ming.springboot.mbg.model.Student;
import com.ming.springboot.mbg.model.StudentExample;
import com.ming.springboot.service.StudentService;
import com.ming.springboot.util.StudentDataUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Random;

/**
 * Created by mqsi on 2022/5/18 19:30
 */
@Service
public class StudentServiceImpl implements StudentService {


	@Autowired
	private StudentMapper studentMapper;

	@Override
	public int insert(Student row) {
		return studentMapper.insert(row);
	}

	@Override
	public List<Student> selectByExample(StudentExample example) {
		return studentMapper.selectByExample(example);
	}

	@Override
	public Student findByPk(String sno) {
		System.out.println("查询了数据库！");
		return studentMapper.selectByPrimaryKey(sno);
	}

	@Override
	public void delete(String sno) {
		studentMapper.deleteByPrimaryKey(sno);
	}

	@Override
	public void deleteAll() {
		studentMapper.deleteByExample(new StudentExample());
	}
}
